package com.entity;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.Date;

/**
 * Created with IntelliJ IDEA.
 * User: real
 * Date: 12-7-17
 * Time: 上午11:19
 * To change this template use File | Settings | File Templates.
 */
public class Word {
    /*
    class Word(models.Model):
        word = models.CharField(max_length=150, primary_key=True)
        phonetic_symbol = models.CharField(max_length=150, blank=True)
        explain0 = models.CharField(max_length=768, blank=True)
        explain1 = models.CharField(max_length=768, blank=True)
        explain2 = models.CharField(max_length=768, blank=True)
        pronunciation = models.TextField(blank=True)
        create_on = models.DateTimeField(null=True, blank=True)
        create_by = models.IntegerField(null=True, blank=True)
        */

    String word = "";

    public String getword(){
        return this.word;
    }

    public void setword(String w){
        this.word = w;
    }

    String phonetic = "";

    public String getphonetic(){
        return this.phonetic;
    }

    public void setphonetic(String p){
        this.phonetic = p;
    }

    String explain0 = "";

    public String getexplain0(){
        return this.explain0;
    }

    public void setexplain0(String e){
        this.explain0 = e;
    }


    String explain1 = "";

    public String getexplain1(){
        return this.explain1;
    }

    public void setexplain1(String e){
        this.explain1 = e;
    }


    String explain2 = "";

    public String getexplain2(){
        return this.explain2;
    }

    public void setexplain2(String e){
        this.explain2 = e;
    }


    byte[] pronunciation = null;

    public byte[] getpronunciation(){
        return this.pronunciation;
    }

    public void setpronunciation(byte[] bytes){
        this.pronunciation = bytes;
    }

    Date create_on;

    public Date getcreate_on()
    {
        return this.create_on;
    }

    public void setcreate_on(Date d)
    {
        this.create_on = d;
    }

    int create_by;

    public int getcreate_by()
    {
        return this.create_by;
    }

    public void setcreate_by(int id)
    {
        this.create_by = id;
    }

    public static Word parseJson(JSONObject json) throws JSONException {

        Word word = new Word();
        word.setword(json.get("word").toString());
        word.setphonetic(json.get("phonetic").toString());
        word.setexplain0(json.get("explain0").toString());

        return word;
    }



}
